package com.itheima.d3_collection_traverse;
import java.util.ArrayList;
import java.util.Collection;
/**
     目标：Collection集合的遍历方式二：增强for
 */
public class Demo02EnhancedFor {
    public static void main(String[] args) {
        Collection<String> c = new ArrayList<>();
        c.add("赵敏");
        c.add("小昭");
        c.add("素素");
        c.add("灭绝");
        System.out.println(c);

        // 使用增强for遍历集合或者数组。
        //c.for + 回车   快速生成
        for (String name : c) {
//            System.out.println("name = " + name);
            name = "张三";
        }
        System.out.println("c = " + c);

        int[] scores = {100, 99, 88, 78};
        for (int score : scores) {
            System.out.println("score = " + score);
        }

    }
}
